//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.data.biz.utils.servlet;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ServletHolderFilter implements Filter {
    protected Log logger = LogFactory.getLog(this.getClass());
    private static final ThreadLocal<ServletInfo> threadLocal = new ThreadLocal();

    public ServletHolderFilter() {
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        try {
            setContext(new ServletInfo((HttpServletRequest)request, (HttpServletResponse)response));
            chain.doFilter(request, response);
        } finally {
            setContext((ServletInfo)null);
        }

    }

    private static void setContext(ServletInfo sc) {
        threadLocal.set(sc);
    }

    public static ServletInfo getContext() {
        return (ServletInfo)threadLocal.get();
    }

    public void destroy() {
    }

    public void init(FilterConfig arg0) throws ServletException {
    }
}
